package com.okami.clazz.two;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.validation.annotation.Validated;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;

/**
 * @author: TanJingyu
 * @create: 2021-03-20 17:38
 **/
public class Test {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, ClassNotFoundException, InstantiationException {
        Class<?> clazz = Class.forName("com.okami.clazz.two.haha.Demo");

        Constructor<?> constructor = clazz.getDeclaredConstructor();
        constructor.setAccessible(true);

        Method show = clazz.getDeclaredMethod("show");
        show.setAccessible(true);
        show.invoke(constructor.newInstance());


//        DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
//        Map<String, Validated> beans = factory.getBeansOfType(Validated.class);
//        beans.forEach((typeName, validated) -> {
//            validated.value();
//        });

    }
}
